<?php

class homeAction extends BaseAction 
{
	function doIndex()
	{
            echo 'sss';
	}
	
	function doView($tid=153250)
	{
		$tid	= !is_numeric($tid)?1:$tid;
		$sql	= 'select p.fid as fid,p.pid as pid,p.author as author,p.authorid as authorid ,
				p.dateline as dateline,p.subject as title,p.message as message,p.first as one from pre_posts 
				p left join pre_forums f on p.fid=f.fid where p.tid='.$tid.' order by p.first desc, p.dateline desc limit 0,10';
		$rs		= ORM_Finder::sqlAll($sql, 'Admin', 7200);
		if(empty($rs)){
			$this->redirect(MY_HOST);
		}else{
			//print_r($rs);
			//echo $rs['0']->getTitle();
			$this->setPageTitle($rs['0']->getTitle().TITLE);
			$this->set('rs', $rs);
			$this->render();
		}
	}
	
	function doReply($tid=1, $page=1)
	{
		$tid		= !is_numeric($tid)?1:$tid;
		$page		= !is_numeric($page)?1:$page;
		$offSet		= 0;
		$pageimit	= 10;
		$this->setPageTitle('帖子回复');
		$where		= 'tid='.$tid.' and first=0';
		$rs			= ORM_Finder::find('Posts', $where, 'pid,tid,author,authorid,dateline,message', 'dateline desc',"$offSet,$pageimit", false, 7200);
		$total		= ORM_Finder::findCount('Posts', $where,'tid', 7200);
		
		$this->set('rs', $rs);
		$this->set('tid', $tid);
		$this->render();
	}
}